const ws =require('ws')
const server = new ws.Server({port:8888})
let arr=[]
server.on('connection',function(ws){
    arr.push(ws)
    console.log('连接成功')
    ws.on('message',function(data){
        for(let i =0;i<arr.length;i++){
            arr[i].send(data.toString())
        }
    })
})